<%@ Page Language="C#" MasterPageFile="~/Report.master" AutoEventWireup="true" CodeFile="Invoice.aspx.cs" Inherits="Pages_Employee_ManageDeliveries_Invoice" Title="Delivery Invoice" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<br />
<div>
<h2><asp:Label ID="Label1" runat="server" style="text-align:center">Delivery Invoice</asp:Label></h2>
<asp:HyperLink ID="lnkAddNewDelivery" runat="server" NavigateUrl="~/Pages_Employee/ManageDeliveries/AddDelivery.aspx"></asp:HyperLink>
<br />
    <asp:DetailsView style="margin:auto; text-align:left" ID="DetailsView1" runat="server" DataSourceID="SqlDataSource1" Height="50px"
        Width="427px" AutoGenerateRows="False" CellPadding="4" GridLines="Horizontal" BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" DataKeyNames="DeliverableID">
        <FooterStyle BackColor="White" ForeColor="#333333" />
        <EditRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
        <RowStyle BackColor="White" ForeColor="#333333" />
        <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
        <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
        <Fields>
            <asp:BoundField DataField="DeliverableID" HeaderText="Deliverable ID:" ReadOnly="True"
                SortExpression="DeliverableID" />
            <asp:BoundField DataField="Customer" HeaderText="Customer:" ReadOnly="True" SortExpression="Customer" />
            <asp:BoundField DataField="Contact Number" HeaderText="Contact number:" ReadOnly="True"
                SortExpression="Contact Number" />
            <asp:BoundField DataField="Employee" HeaderText="Created by employee:" ReadOnly="True" SortExpression="Employee" />
            <asp:TemplateField HeaderText="Date:" SortExpression="CreatedDate">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("CreatedDate") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("CreatedDate") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# DateTime.Parse(Eval("CreatedDate").ToString()).ToString("dd/MM/yyyy") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Service charge:" SortExpression="Charge">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Charge") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Charge") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# String.Format("{0:C}", Convert.ToDecimal(Eval("Charge"))) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Tax percentage:" SortExpression="TaxPercentage">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("TaxPercentage") %>'></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("TaxPercentage") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("TaxPercentage")  + "%"%>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Total charge:" SortExpression="TotalCharge">
                <EditItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("TotalCharge") %>'></asp:Label>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("TotalCharge") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# String.Format("{0:C}", Convert.ToDecimal(Eval("TotalCharge"))) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Fields>
    </asp:DetailsView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TarsConnection %>" ProviderName="System.Data.SqlClient" SelectCommand="SELECT DeliverableID, &#13;&#10;            (SELECT Customers.FullName FROM Customers WHERE CustomerID=@CustomerID) AS Customer,&#13;&#10;            (SELECT Customers.ContactNumber FROM Customers WHERE CustomerID=@CustomerID) AS [Contact Number], &#13;&#10;            (SELECT Accounts.FullName FROM Accounts WHERE Accounts.UserName = Invoices.UserName) AS Employee, &#13;&#10;            CreatedDate, Charge, TaxPercentage, TotalCharge &#13;&#10;FROM Invoices &#13;&#10;WHERE (DeliverableID = @DeliverableID)">
        <SelectParameters>
            <asp:SessionParameter Name="CustomerID" SessionField="CurrentCustomerID" />
            <asp:SessionParameter Name="DeliverableID" SessionField="CreatedDeliverableID" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
    <br />
    <br />
</div>
</asp:Content>

